package com.heyqing.dynamic.Backpack0or1;

import java.util.Scanner;

/**
 * ClassName:Goods
 * Package:com.heyqing.dynamic.Backpack0or1
 * Description:
 *
 * @Date:2024/6/4
 * @Author:Heyqing
 */
public class Goods {
    // 物品数量
    private int n;
    // 物品重量
    private int[] wt;
    // 物品价值
    private int[] val;

    public Goods() {
        System.out.println("请输入物品数量：");
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        wt = new int[n];
        val = new int[n];
        for (int i = 0; i < n; i++) {
            System.out.print("请输入物品"+(i+1)+"的重量：");
            wt[i] = sc.nextInt();
            System.out.print("请输入物品"+(i+1)+"的价值：");
            val[i] = sc.nextInt();
        }
        sc.close();
    }

    public int getN() {
        return n;
    }

    public int[] getWt() {
        return wt;
    }

    public int[] getVal() {
        return val;
    }
}
